1. Field
The following description relates to the conversion of binary data, and, more particularly, to an apparatus and method capable of incorporating rounding and two's complementation during the conversion of data.
2. Description of the Related Art
In computing, binary data is used to represent various numeric values using different combinations of ones and zeros. Binary data can be represented in various formats. For example, floating-point units (FPUs) process binary data represented in a floating-point number format. Thus, in order for FPUs to process binary data represented in an integer or fixed-point number format, the binary data needs to be converted into a floating-point number.
Floating-point binary data is represented as a sign magnitude number, in which the most significant bit indicates whether the represented value is positive or negative, whereas integer binary data or fixed-point binary data is represented as a two's complement number, which allows for simple addition of values by encoding negative numbers into ordinary binary. Therefore, in order to convert binary data between a floating-point number and an integer, a rounding module and a two's complement module are both required. For example, a floating-point number is converted into a two's complement integer by adding one to the floating-point number if the floating-point number is rounded up, and adding one to the one's complement of the floating-point number.
Conventionally, two adders (i.e., one adder for adding one to a floating-point number if the floating-point number is rounded up and the other for adding one to the one's complement of the floating-point number) are required to realize a floating-point number-to-integer converter.